﻿<%@ Page Title="" Language="C#" MasterPageFile="~/UI/Administrator/Dashboard.Master"
    AutoEventWireup="true" CodeBehind="ScheduleManagement.aspx.cs" Inherits="OnlineRailway.UI.Administrator.ScheduleManagement" %>
    
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link rel="stylesheet" type="text/css" href="../../Style/MainContent.css"/>
    <script type="text/javascript">
        function ConfirmationBox(ScheduleName) {
            var result = confirm('Are you sure you want to delete "' + ScheduleName + '" schedule?');
            if (result) {
                return true;
            }
            else {
                return false;
            }
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentMain" runat="server">
    <div id="main">
        <div id="form">
            <div id="header">
                <p>
                    Schedule manager</p>
                <asp:Button runat="server" ID="btnScheduleCreate" Text="Create schedule" CssClass="btnNav btnNavTop"
                    PostBackUrl="~/UI/Administrator/ScheduleCreate.aspx" />
            </div>
            <div id="form-content">
                <div class="lblError">
                    <asp:Label runat="server" ID="lblMessage"></asp:Label></div>
                <div id="div-GridView">
                    <asp:GridView runat="server" ID="gvSchedule" CssClass="gv" DataKeyNames="ScheduleID,ScheduleName" 
                        AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" 
                        GridLines="None" onrowcancelingedit="gvSchedule_RowCancelingEdit" 
                        onrowediting="gvSchedule_RowEditing" 
                        onrowdeleting="gvSchedule_RowDeleting" 
                        onrowdatabound="gvSchedule_RowDataBound" 
                        onrowupdating="gvSchedule_RowUpdating">
                        <AlternatingRowStyle BackColor="White" />
                        <EditRowStyle BackColor="#2461BF" />
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <RowStyle BackColor="#EFF3FB" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <SortedAscendingCellStyle BackColor="#F5F7FB" />
                        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                        <SortedDescendingCellStyle BackColor="#E9EBEF" />
                        <SortedDescendingHeaderStyle BackColor="#4870BE" />

                        <Columns>
                            <asp:TemplateField HeaderText="ID">
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lblID" Text='<%# Eval("ScheduleID") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:Label runat="server" ID="lblIDEdit" Text='<%# Eval("ScheduleID") %>'></asp:Label>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Name">
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lblName" Text='<%# Eval("ScheduleName") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <input id="asd" name="asd" type="text" runat="server" value='<%# Bind("ScheduleName") %>'/>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="StartStation">
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lblStartStation" Text='<%# Eval("StartStation") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox runat="server" ID="txtStartStationEdit" Text='<%# Bind("StartStation") %>'></asp:TextBox>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="EndStartStation">
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lblEndStartStation" Text='<%# Eval("EndStation") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox runat="server" ID="txtEndStationEdit" Text='<%# Bind("EndStation") %>'></asp:TextBox>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="BetweenStation">
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lblBetween" Text='<%# Eval("BetweenStation") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox runat="server" ID="txtBetweenEdit" Text='<%# Bind("BetweenStation") %>'></asp:TextBox>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Distances">
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lblDistances" Text='<%# Eval("Distances") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox runat="server" ID="txtDistancesEdit" Text='<%# Bind("Distances") %>'></asp:TextBox>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="LongTime">
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lblLongTime" Text='<%# Eval("LongTime") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox runat="server" ID="txtLongTime" Text='<%# Bind("LongTime") %>'></asp:TextBox>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Fare">
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lblFare" Text='<%# Eval("Fare") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox runat="server" ID="txtFareEdit" Text='<%# Bind("Fare") %>'></asp:TextBox>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Description">
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lblDes" Text='<%# Eval("Description") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox runat="server" ID="txtDesEdit" Text='<%# Bind("Description") %>'></asp:TextBox>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="CreateDate">
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lblCreateDate" Text='<%# Eval("CreateDate") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox runat="server" ID="txtCreateDate" Text='<%# Bind("CreateDate") %>'></asp:TextBox>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Status">
                                <ItemTemplate>
                                    <asp:DropDownList runat="server" ID="ddlStatus" Enabled="False" SelectedValue='<%# Eval("Status") %>'>
                                        <asp:ListItem>Enabled</asp:ListItem>
                                        <asp:ListItem>Disabled</asp:ListItem>
                                    </asp:DropDownList>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:DropDownList runat="server" ID="ddlStatusEdit" Enabled="True" SelectedValue='<%# Bind("Status") %>'>
                                        <asp:ListItem>Enabled</asp:ListItem>
                                        <asp:ListItem>Disabled</asp:ListItem>
                                    </asp:DropDownList>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Action">
                                <ItemTemplate>
                                    <asp:ImageButton runat="server" ID="ibtnEdit" ToolTip="Edit" ImageUrl="../../StorageImage/icon-edit.png" ImageAlign="Baseline" CommandName="Update"/>
                                    <asp:ImageButton runat="server" ID="ibtnDelete" ToolTip="Delete" ImageUrl="../../StorageImage/icon-delete.png" ImageAlign="Baseline" CommandName="Delete"/>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:ImageButton runat="server" ID="ibtnUpdate" ToolTip="Update" ImageUrl="../../StorageImage/icon-update.png" ImageAlign="Baseline" CommandName="Update"/>
                                    <asp:ImageButton runat="server" ID="ibtnCancel" ToolTip="Cancel" ImageUrl="../../StorageImage/icon-cancel.png" ImageAlign="Baseline" CommandName="Cancel"/>
                                </EditItemTemplate>
                            </asp:TemplateField>
                        </Columns>    
                    </asp:GridView>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
